package edu.uoc.practica.bd.uocbugdb.exercise2;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import edu.uoc.practica.bd.util.Column;
import edu.uoc.practica.bd.util.DBAccessor;
import edu.uoc.practica.bd.util.Report;

public class Exercise2QueryOverProcedure {
	public static void main(String[] args) {
		Exercise2QueryOverProcedure app = new Exercise2QueryOverProcedure();
		app.run();
	}

	private void run() {
		DBAccessor dbaccessor = new DBAccessor();
		dbaccessor.init();
		Connection conn = dbaccessor.getConnection();

		List<Column> columns = Arrays.asList( //
				new Column("Code", 4, "code"), //
				new Column("First Name", 10, "firstName"), //
				new Column("Surname", 10, "surname"), //
				new Column("Opened", 6, "opened"), //
				new Column("Estimated", 6, "estimated") //
				);
		Report report = new Report();
		report.setColumns(columns);
		List<Object> list = new ArrayList<Object>();
		// TODO Query over the procedure get_all_products()

		// TODO Loop over all the results and get the values
		String code = null;
		String firstName = null;
		String surname = null;
		int opened = 0;
		int estimated = 0;
		Exercise2Row row = new Exercise2Row(code, firstName, surname, opened,
				estimated);
		// list.add(row);
		// TODO End Loop

		report.printReport(list);
		// TODO Close all resources
	}
}
